package com.easy.controller;

import com.easy.entity.Staff;
import com.easy.entity.Vip;
import com.easy.service.VipService;
import com.easy.utils.LayData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @ClassName VipController
 * @Description TODO
 * @Author 周轩霆
 * @Date 2022/5/27 16:36
 **/
@RestController
@RequestMapping("vip")
public class VipController {

    @Autowired
    VipService vipService;

    @RequestMapping("getList")
    public LayData getList(@RequestParam Map params) {
        // layui传递的参数 page,limit每页显示几条
        // System.out.println(params);
        // {code,msg,count,data}格式
        // count是查询数据的总条数
        // list 是当前也显示的数据
        
        int count = vipService.getCount(params);
        List<Vip> list = vipService.getList(params);
        LayData ld = new LayData(count, list);
        return ld;

    }

    @RequestMapping("del")
    public int del(@RequestParam Map params) {

        return vipService.del(params);

    }

    @RequestMapping("add")
    public int add(@RequestParam Map params) {


        return vipService.add(params);

    }

    @RequestMapping("edit")
    public int edit(@RequestParam Map params) {


        return vipService.edit(params);

    }


}
